﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Frontend.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="CphTitleContent" ContentPlaceHolderID="TitleContent" runat="server">
    Giỏ hàng
</asp:Content>
<asp:Content ID="CphHeadContent" ContentPlaceHolderID="HeadContent" runat="server">
    <script src="/Scripts/Grid/js/i18n/grid.locale-en.js" type="text/javascript"></script>    
    <script src="/Scripts/Grid/js/jquery.jqGrid.js" type="text/javascript"></script>
    <script src="/Scripts/Grid/js/grid.base.js" type="text/javascript"></script>
    <link href="/Scripts/Grid/themes/ui.jqgrid.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(document).ready(function () {
            jQuery("#list").jqGrid({
                url: '/OrderView/GetListJQGrid/',
                datatype: 'json',
                mtype: 'GET',
                colNames: ['ID', 'Hình', 'Tên Sản Phẩm', 'Giá', 'Số Lượng', 'Thành Tiền', 'Position', 'X'],
                colModel: [
                  { name: 'ID', index: 'ID', align: "center", width: 50, hidden: true },
                  { name: 'Image', index: 'ProductName', align: "center", width: 60, sortable: false },
                  { name: 'ProductName', index: 'ProductName', align: "left", width: 100, sortable: false },
                  { name: 'Price', index: 'Price', align: "center", width: 60, sortable: false },
                  { name: 'Quantity', index: 'Quantity', align: "center", width: 60, sortable: false },
                  { name: 'Subtotal', index: 'Subtotal', align: "center", width: 60, sortable: false },
                  { name: 'Postion', index: 'Postion', align: "left", width: 10, hidden: true, sortable: false },
                  { name: 'Action', index: 'Action', editable: false, width: 40, align: 'center', sortable: false}],
                sortname: 'Postion',
                sortorder: "asc",
                viewrecords: true,
                width: 680, height: "100%",
                imgpath: '/scripts/grid/themes/basic/images',
                loadui: 'block'
            });
            $("#btnBack").click(function () {
                JS_LIB.back();
            });
            $("#btnPay").click(function () {
                JS_LIB.redirect("/OrderView/Payment");
            });
        });

        function DeleteOrder(Id) {
            jConfirm("Bạn có chắc là bạn muốn xóa ?", "Confirm", function (r) {
                if (r)
                    window.location = "/OrderView/Delete/" + Id;
            });
        }
    </script>
    <style type="text/css">
        .ui-jqgrid tr.jqgrow td
        {
            white-space: normal;
        }
    </style>
</asp:Content>
<asp:Content ID="CphMainContent" ContentPlaceHolderID="MainContent" runat="server">
    <%using (Html.BeginForm("UpdateList", "OrderView", FormMethod.Post, new { id = "orderForm", @class = "form" }))
      {%>
    <%= TempData["Message"] %>    
    <div class="ccat">
        <table border="0" cellpadding="0" cellspacing="0" width="100%">
            <tr>
                <td class="ccat-lft">
                    <div class="cat-header">
                        <span>Danh mục</span>
                    </div>
                    <% Html.RenderPartial("Modules/Mod_SubMenu"); %>
                </td>
                <td class="ccat-rgh">
                    <div class="ccat-breadcrumb">
                        <%= (string)ViewData["NavigationLink"]%>
                    </div>
                    <div class="ccat-partner">
                        <div class="clist">                            
                            <table id="list" class="scroll">
                            </table>

                            <% if (((List<Order>)ViewData.Model).Count > 0)
                               { %>

                            <table width="680px">
                                <tr>
                                    <td style="text-align: right; width: 80%; font-size: large">
                                        <b>Tổng tiền:&nbsp;&nbsp;&nbsp; </b>
                                    </td>
                                    <td style="text-align: left; width: 20%; font-size: large">
                                        <b style="color:Red">
                                            <%=ViewData["Total"]%>
                                        </b>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" style="text-align: right;">
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" style="text-align: right;">
                                        <input id="btnUpdate" type="submit" value="Cập Nhật"/>                                            
                                        <input id="btnBack" type="button" value="Tiếp Tục Mua"/>
                                        <input id="btnPay" type="button" value="Gửi Đơn Hàng"/>                                        
                                    </td>
                                </tr>
                            </table>
                            <%}
                            else
                            { %>
                                <table width="680px">
                                <tr>
                                    <td align="center">Không có sản phẩm nào trong giỏ hàng của bạn !!!</td>
                                </tr>
                                </table>
                            <%} %>
                        </div>                        
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <% } %>
</asp:Content>
